package com.jason.kotlin.gank.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jason.kotlin.gank.R
import com.jason.kotlin.gank.model.RollForecastBean
import com.jason.kotlin.gank.util.WeatherUtils

/**
 * @description: WeatherItemAdapter
 *
 * @author ChenBaoyang
 * @date 4/27/21 16:18
 */
class WeatherItemAdapter :
    BaseQuickAdapter<RollForecastBean, BaseViewHolder>(R.layout.item_weather_later_item) {

    override fun convert(holder: BaseViewHolder, item: RollForecastBean) {
        item.run {
            holder.setText(R.id.tv_01, "--")
            holder.setText(R.id.tv_02, "--")
            holder.setText(R.id.tv_03, "--")
            holder.setText(R.id.tv_04, "--")
            holder.setText(R.id.tv_05, "--")
            holder.setText(R.id.tv_06, "--")
            holder.setText(R.id.tv_07,"--")
            holder.setText(R.id.tv_08,"--")
            holder.setText(R.id.tv_09,"--")
            holder.setText(R.id.tv_10,"--")

            holder.setText(R.id.tv_01, dayOfWeek)
            holder.setText(R.id.tv_02, date.substring(5))

            //白天
            holder.setText(R.id.tv_03, dayWeather)
            holder.setText(R.id.tv_04, dayTemp)
            holder.setText(R.id.tv_09, dayWindPower)
            holder.setText(R.id.tv_10, dayWindDirection)

            //夜间
            holder.setText(R.id.tv_05, nightTemp)
            holder.setText(R.id.tv_06, nightWeather)
            holder.setText(R.id.tv_07, nightWindPower)
            holder.setText(R.id.tv_08, nightWindDirection)

            holder.setImageResource(R.id.iv_01, WeatherUtils.getWeatherResId(dayWeather))
            holder.setImageResource(R.id.iv_02, WeatherUtils.getWeatherResId(nightWeather))



        }
    }
}